<?php
namespace App\Controller;
class MemberController extends BaseController
{
    /**
     * 首页
     */
    public function index(){
        $model = D('App/Base');
        $page_title = C("TITLE");

        $this->assign(array(
            'hot_disease'    => $hot_disease,
            'friend_link'    => true,
        ));
        $this->setPageInfo("{$page_title['title']}", "{$page_title['keyword']}", "{$page_title['desc']}", 1);
        $this->display();
    }

    //ajax注册会员
    public function reg_ajax(){
        $data['status']  = 'y';
        $data['info'] = '恭喜你,注册成功';
        $this->ajaxReturn($data);
    }

    //ajax检查用户登录信息
    public function user_ajax(){
        echo 111;die();
    }

    //ajax用户登录
    public function login_ajax(){
        $mobile = I('mobile');
        $password = I('pwd');
        $data = M('User')->field('id,username')->where(array('mobile_phone'=>array('eq',$mobile),'password'=>array('eq',md5($password))))->find();
        if($data){
            //登录成功
            session('user_id', $data['id']);
            session('user_name', $data['username']);
            $result['status']  = 'y';
            $result['info'] = 'hello world';
        }else{
            $result['status']  = 'n';
            $result['info'] = '用户名或密码错误';
        }
        $this->ajaxReturn($result);
    }

    //ajax找回密码
    public function findpwd_ajax(){
        $data['status']  = 'y';
        $data['info'] = 'hello world';
        $this->ajaxReturn($data);
    }

    //ajax检查注册图形验证码
    public function verify_code_ajax()
    {
        $code = I('value');
        $verify = new \Think\Verify();
        // return $verify->check($code);
        $this->ajaxReturn(true);
    }

    //ajax检查手机短信验证码
    public function mobile_code_ajax()
    {
        $code = I('value');
        $verify = new \Think\Verify();
        // return $verify->check($code);
        $this->ajaxReturn(true);
    }
}